#pragma once
#include "renderableobject.h"
#include "../ResourceManagement/ImageLib.h"
#include "../Math/glbbox.h"

#define QUAD 4

#define SEC1 0
#define SEC2 1
#define SEC3 2
#define SEC4 3

#define BLOCK_SIZE 16

#define BLOCK_SCALE 1

class CRenderQueue;
class GLfrustum;

class QuadNode :
	public IRenderable
{
private:
	IRenderable *pRenderable[QUAD];

	ILimage *pHeightMap;
	RECT rect;

	GLbbox m_bbox;
public:
	QuadNode(void);

	void Draw();//draw subtree recursively
	void BuildSubTree(::ILimage*,::RECT); //construct sub tree
	bool IsSubdvideLimitMeet(::RECT&);//check sub divide already meet requirement
public:
	virtual ~QuadNode(void);

	void ExtractRenderables(CRenderQueue& rq,GLfrustum& cam);
};
